﻿<script>
    _columns = [
                    {
                        bind: 'Title', title: '标题', format: function (val, data) {
                            return '<a href="/article/' + data.Id + '" target="_blank">' + val + "</a>";
                        }
                    },
                    @if (Model.ShowAudit) {
                            <text>
                        {
                            bind: 'Status', title: '审核状态', format: function (val, data) {
                                switch (val) {
                                    case 2:
                                        return '<span class="am-badge">未通过</span>';
                                    case 3:
                                        return '<span class="am-badge am-badge-success">已通过</span>';
                                    default:
                                        return '<span class="am-badge am-badge-secondary">待审核</span>';
                                }
                            }
                        },
                            </text>
                    } else {
                        <text>
                        {
                            bind: 'Publish', title: '发布状态', format: function (val, data) {
                                if (val)
                                    return '<span class="am-badge am-badge-success">已发布</span>'
                                return '<span class="am-badge am-badge-secondary">待发布</span>';
                            }
                        },
                        </text>
                    }
                    {  bind: 'AddDate', title: '发布时间' },
                    {  bind: 'LastModify', title: '修改时间' },

                    {
                       bind: 'ByOrder', title: '排序', width: '110px', format: function (val, data) {
                            var html = '<div class="tb-item-edit"><a class="am-btn am-btn-info" onclick="article_vm.setOrder(' + data.Id + ',' + val + ',\'up\')"><i class="am-icon-arrow-up"></i></a>';
                            html += '<a class="am-btn am-btn-primary" style="margin-right:8px" onclick="article_vm.setOrder(\'' + data.Id + '\',' + val + ',\'down\')"><i class="am-icon-arrow-down"></i></a>';
                            html += '<a class="am-btn am-btn-danger" onclick="article_vm.setOrder(\'' + data.Id + '\',' + val + ',\'top\')" title="置顶"><i class="icon icon-top"></i></a>';
                            html += '</div>'
                            return html;
                       }
                    },
                    {
                        bind: 'Id', title: '编辑', width: '100px', format: function (val, data) {
                            var html = '<div class="tb-item-edit"><a class="am-btn am-btn-info" onclick="article_vm.editArticle(\'' + val + '\')"><i class="am-icon-edit"></i></a>';
                            html += '<a class="am-btn am-btn-danger" onclick="article_vm.delArticle(\'' + val + '\')"><i class="am-icon-trash"></i></a></div>';
                            return html;
                        }
                    }
                ]
</script>